/*
 *    Copyright 2009-2010 The iBaGuice Team
 *
 *    Licensed under the Apache License, Version 2.0 (the "License");
 *    you may not use this file except in compliance with the License.
 *    You may obtain a copy of the License at
 *
 *       http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing, software
 *    distributed under the License is distributed on an "AS IS" BASIS,
 *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *    See the License for the specific language governing permissions and
 *    limitations under the License.
 */
package com.google.code.ibaguice.dao;

import org.apache.ibatis.session.TransactionIsolationLevel;

/**
 * Any method or class marked with this annotation will be considered for
 * transactionality.
 *
 * @author Simone Tripodi
 * @author Marco Speranza
 * @version $Id: IsolationLevel.java 1981 2010-03-01 20:20:02Z simone.tripodi $
 */
public enum IsolationLevel {

    NOT_SPECIFIED(null),
    NONE(TransactionIsolationLevel.NONE),
    READ_COMMITTED(TransactionIsolationLevel.READ_COMMITTED),
    READ_UNCOMMITTED(TransactionIsolationLevel.READ_UNCOMMITTED),
    REPEATABLE_READ(TransactionIsolationLevel.REPEATABLE_READ),
    SERIALIZABLE(TransactionIsolationLevel.SERIALIZABLE);

    /**
     * The iBatis transaction isolation level.
     */
    private final TransactionIsolationLevel level;

    /**
     * Build a new Isolation level by the iBatis transaction isolation level.
     *
     * @param level the iBatis transaction isolation level.
     */
    private IsolationLevel(TransactionIsolationLevel level) {
        this.level = level;
    }

    /**
     * Returns the iBatis transaction isolation level.
     *
     * @return the iBatis transaction isolation level.
     */
    public TransactionIsolationLevel getLevel() {
        return this.level;
    }

}
